# Copyright (c) 2018 Presto Labs Pte. Ltd.
# Author: leon

from coin.exchange.base.kr_rest.order_base import OrderBase
from coin.exchange.bittrex_v1.kr_rest.private_client import BittrexPrivateClient
from coin.exchange.bittrex_v1.kr_rest.product import BittrexProduct


class BittrexV1Order(OrderBase):
  ProductType = BittrexProduct

  def __init__(self, products, key_file):
    OrderBase.__init__(self, products, key_file)
    self.client = BittrexPrivateClient(key_file)

  def query_balance_impl(self):
    return self.client.query_account_balance()

  def query_submit(self, product, side, price, qty):
    return self.client.query_submit(product, side, price, qty)

  def query_cancel(self, product, order_id):
    return self.client.query_cancel(product, order_id)

  def query_cancel_product(self, product):
    return self.client.query_cancel_product(product)

  def query_list_orders(self, product):
    return self.client.query_list_orders(product)
